#include "SeedDTO.h"
#include <utils/Jquery.h>

SeedDTO::SeedDTO(std::string strName,
				 std::string strDesc,
				 std::string strVer,
				 std::string strStartExe,
				 std::string strUrl,
				 std::string strMd5,
				 int iLen)
{
	m_strName = strName;
	m_strDesc = strDesc;
	m_strVer = strVer;
	m_strStartExe = strStartExe;
	m_strUrl = strUrl;
	m_strMd5 = strMd5;
	m_iLen = iLen;
}



SeedDTO* SeedDTO::ParseDTO(TiXmlElement* pEle)
{
	if(NULL == pEle)
	{
		return NULL;
	}


	std::string strName = Jquery::GetAttr(pEle,XML_ATTR_NAME,UTF8_2_ACP);
	std::string strDesc = Jquery::GetAttr(pEle,XML_ATTR_DESC,UTF8_2_ACP);
	std::string strVersion = Jquery::GetAttr(pEle,XML_ATTR_VERSION,UTF8_2_ACP);
	std::string strStartExe = Jquery::GetAttr(pEle,XML_ATTR_STARTEXE,UTF8_2_ACP);
	std::string strUrl = Jquery::GetAttr(pEle,XML_ATTR_URL,UTF8_2_ACP);
	std::string strMd5 = Jquery::GetAttr(pEle,XML_ATTR_MD5,UTF8_2_ACP);
	std::string strLen = Jquery::GetAttr(pEle,XML_ATTR_LEN,UTF8_2_ACP);

	SeedDTO *pDto = new SeedDTO(strName,strDesc,strVersion,strStartExe,strUrl,strMd5,StringUtil::atoi(strLen));
	return pDto;
}


std::string SeedDTO::GetUrl()
{
	return m_strUrl;
}

std::string SeedDTO::GetStartExe()
{
	return m_strStartExe;
}

std::string SeedDTO::GetMd5()
{
	return m_strMd5;
}